using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_CURRENTdentMap : EntityTypeConfiguration<SO_CURRENTdent>
    {
        public SO_CURRENTdentMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Entry_date, t.Latin_Last_Name, t.Arabic_Last_Name, t.Current_Admission, t.IID });

            // Properties
            this.Property(t => t.ID)
                .HasMaxLength(10);

            this.Property(t => t.PATIENT_ID)
                .HasMaxLength(6);

            this.Property(t => t.CASE__)
                .HasMaxLength(15);

            this.Property(t => t.Latin_Name)
                .HasMaxLength(60);

            this.Property(t => t.Arabic_Name)
                .HasMaxLength(30);

            this.Property(t => t.Attending_PHYSICIAN)
                .HasMaxLength(25);

            this.Property(t => t.Latin_Last_Name)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Arabic_Last_Name)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Entry_Type)
                .HasMaxLength(25);

            this.Property(t => t.Phones)
                .HasMaxLength(30);

            this.Property(t => t.ADDRESS)
                .HasMaxLength(80);

            this.Property(t => t.Current_Admission)
                .IsRequired()
                .HasMaxLength(4);

            this.Property(t => t.IID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Table & Column Mappings
            this.ToTable("SO_CURRENTdent");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.PATIENT_ID).HasColumnName("PATIENT_ID");
            this.Property(t => t.CASE__).HasColumnName("CASE_#");
            this.Property(t => t.Entry_date).HasColumnName("Entry_date");
            this.Property(t => t.Latin_Name).HasColumnName("Latin_Name");
            this.Property(t => t.Arabic_Name).HasColumnName("Arabic_Name");
            this.Property(t => t.Balance_B1).HasColumnName("Balance_B1");
            this.Property(t => t.Balance_B2).HasColumnName("Balance_B2");
            this.Property(t => t.Attending_PHYSICIAN).HasColumnName("Attending_PHYSICIAN");
            this.Property(t => t.Latin_Last_Name).HasColumnName("Latin_Last_Name");
            this.Property(t => t.Arabic_Last_Name).HasColumnName("Arabic_Last_Name");
            this.Property(t => t.Entry_Type).HasColumnName("Entry_Type");
            this.Property(t => t.Phones).HasColumnName("Phones");
            this.Property(t => t.ADDRESS).HasColumnName("ADDRESS");
            this.Property(t => t.Current_Admission).HasColumnName("Current_Admission");
            this.Property(t => t.IID).HasColumnName("IID");
        }
    }
}
